#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
int t;
LL a[N];

int main()
{
	cin >> t;
	while(t--)
	{
		int n; cin >> n;
		for(int i = 1; i <= n; i++) cin >> a[i];
		sort(a + 1, a + 1 + n);
		LL maxo = 0;
		for(int i = n; i >= 1; i--)
		{
			if(a[i] % 2 == 1) 
			{
				maxo = a[i];
				break;
			}
		}
//		cout << maxo << endl;
		if(maxo == 0) cout << 0 << endl;
		else
		{
			int ans = 0;
			LL maxe = 0;
			for(int i = n; i >= 1; i++)
				if(a[i] % 2 == 0) 
				{
					maxe = a[i];
					break;
				}
				for(int i = 1; i <= n; i++)
				{
					if(a[i] % 2 == 0) ans++;
				}
			LL tmp = maxo;
			int ans1 = 0;
			for(int i = 1; i <= n; i++)
			{
//				cout << i << ":" << maxo << endl;
				if(a[i] % 2 == 0)
				{
					if(a[i] > maxo)
					{
						ans1 += 2;
						maxo = maxo + 2 * a[i];
					}
					else
					{
						maxo = maxo + a[i];
						ans1++;
					}
				}
			}
				if(tmp > maxe)
				{
					cout << min(ans, ans1) << endl;
				}
				
				else cout << min(ans + 1, ans1) << endl;
		}
	}
	return 0;
}
